import React from 'react';
import style from './index.module.scss';
import PropTypes from 'prop-types'
import MuiButton from '@mui/material/Button';

Button.propTypes = {
    BtnClick: PropTypes.func.isRequired,
    text: PropTypes.string.isRequired,
    color: PropTypes.string,
    background: PropTypes.string,
    fontSize: PropTypes.string,
    isAll: PropTypes.bool,
    isShadow: PropTypes.bool,
    width: PropTypes.string
}
Button.defaultProps = {
    text: '按钮',
    color: '#FFF',
    background: '#3C9CFF',
    fontSize: '20px',
    isAll: false,
    isShadow: false,
    borderRadius: '0',
    width: '100%'
}


export default function Button(props) {
    const { BtnClick, text, color, background, fontSize, isAll, isShadow, borderRadius, width  } = props;
    let styleObj = {
        text,
        color,
        background,
        fontSize,
        width: isAll ? '100vw' : width,
        boxShadow: isShadow ? '' : 'none',
        borderRadius: borderRadius
    }
    return (
        <>
            <MuiButton style={styleObj} onClick={BtnClick} variant="contained">
                {text}
            </MuiButton>
        </>
    )
}
